<!DOCTYPE html>
<html>
  <head><meta name="generator" content="Hexo 3.8.0">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="fengzhaoyang&#39;s blog">
  <meta name="keyword" content="hexo-theme, vuejs">
  
  <link rel="shortcut icon" href="/css/images/logo.png">
  
  <title>
    
    Centos 安装 nfs | fzy-blog
    
  </title>
  <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/css/style.css">
  
  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
  
  <script src="/js/qrious.js"></script>
  
  
  
  
    <!-- MathJax support START -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <!-- MathJax support END -->
  


</head>
<div class="wechat-share">
  <img src="/css/images/logo.png">
</div>
  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>fzy-blog</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link">Home</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">Tags</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">Archives</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/project/" class="item-link">Projects</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">About</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link">Home</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">Tags</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">Archives</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/project/" class="menu-link">Projects</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">About</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <div id="article-banner">
  <h2>Centos 安装 nfs</h2>
  <p class="post-date">2019-05-24</p>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h1 id="Centos-安装-nfs"><a href="#Centos-安装-nfs" class="headerlink" title="Centos 安装 nfs"></a>Centos 安装 nfs</h1><p>检查 nfs 是否启动：<br>1、通过进程查看 nfs 服务是否运行</p>
<p>ps -aux|grep -v grep|grep nfs #有该进程即为开启状态</p>
<p>2、通过命令查看 nfs 服务的状态</p>
<p>/etc/init.d/nfs status<br>3、chkconfig 命令查询系统服务</p>
<p>chkconfig –list nfs<br>检查 nfs 是否安装：</p>
<p>rpm -qa|grep nfs<br>rpm -qa|grep portmap<br>centos 6.0 以上没有 portmap 变成了 rpcbind<br>检查有没有安装 rpcbind</p>
<p>rpm -qa|grep rpcbind<br>安装：</p>
<p>yum -y install nfs-utils rpcbind<br>服务端配置：</p>
<p>#vi /etc/exports</p>
<p>文件内容：</p>
<p>#/opt/issystem/docs 192.168.1.*(rw,sync,no_root_squash)</p>
<p>#service rpcbind start /restart/stop</p>
<p>#service nfs start</p>
<p>查看 nfs 用到的所有端口</p>
<p>#rpcinfo -p localhost</p>
<p>防火墙增加如下端口：<br>vi /etc/sysconfig/iptables<br>-A INPUT -m state –state NEW -m udp -p udp –dport 111 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 111 -j ACCEPT<br>-A INPUT -m state –state NEW -m udp -p udp –dport 875 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 875 -j ACCEPT<br>-A INPUT -m state –state NEW -m udp -p udp –dport 53498 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 33180 -j ACCEPT<br>-A INPUT -m state –state NEW -m udp -p udp –dport 38168 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 38439 -j ACCEPT<br>-A INPUT -m state –state NEW -m udp -p udp –dport 55848 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 32812 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 2049 -j ACCEPT<br>-A INPUT -m state –state NEW -m udp -p udp –dport 2049 -j ACCEPT<br>-A INPUT -m state –state NEW -m udp -p udp –dport 41705 -j ACCEPT<br>-A INPUT -m state –state NEW -m tcp -p tcp –dport 47329 -j ACCEPT</p>
<p>/etc/init.d/iptables restart 最后重启防火墙使配置生效</p>
<p>/etc/init.d/iptables save</p>
<p>/etc/init.d/iptables status 查看打开的端口</p>
<p>查询 nfs 的共享状态<br>showmount -e</p>
<p>显示已经与客户端连接上的目录信息</p>
<p>showmount -a<br>客户端：</p>
<p>mount -t nfs 10.245.8.27:/opt/issystem/docs /opt/issystem/docs<br>显示已经与服务端连接上的目录信息</p>
<p>showmount -e 10.245.8.27<br>检查客户端是否挂载成功和挂载路径</p>
<p>mount |grep nfs<br>设置 NFS 服务器的自动启动状态<br>对于实际的应用系统，每次启动 LINUX 系统后都手工启动 nfs 服务器是不现实的，需要设置系统在指定的运行级别自动启动 portmap 和 nfs 服务。</p>
<p>chkconfig –list portmap<br>chkconfig –list rpcbind<br>chkconfig –list nfs<br>设置 portmap 和 nfs 服务在系统运行级别 3 和 5 自动启动。</p>
<p>chkconfig –level 35 portmap on<br>chkconfig –level 35 rpcbind on<br>chkconfig –level 35 nfs on<br>如果新建文件没有写权限则配置</p>
<p>chmod 777 -R /opt/statics<br>卸载已挂载的 NFS 共享目录</p>
<p>umount /tmp/david/</p>
</section>
    <!-- Tags START -->
    
    <div class="tags">
      <span>Tags:</span>
      
  <a href="/tags#Linux">
    <span class="tag-code">Linux</span>
  </a>

    </div>
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/2019/05/24/Linux/Centosnginx负载均衡+动静分离配置/">
        <span class="nav-arrow">← </span>
        
          Centos nginx 负载均衡+动静分离配置
        
      </a>
    
    
      <a class="nav-right" href="/2019/05/24/Linux/CentOS配置ngnixconf/">
        
          CentOS 配置 ngnix conf
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    <!-- 打赏 START -->
    
    <div class="money-like">
      <div class="reward-btn">
        赏
        <span class="money-code">
          <span class="alipay-code">
            <div class="code-image"></div>
            <b>使用支付宝打赏</b>
          </span>
          <span class="wechat-code">
            <div class="code-image"></div>
            <b>使用微信打赏</b>
          </span>
        </span>
      </div>
      <p class="notice">若你觉得我的文章对你有帮助，欢迎点击上方按钮对我打赏</p>
    </div>
    
    <!-- 打赏 END -->
    <!-- 二维码 START -->
    
    <div class="qrcode">
      <canvas id="share-qrcode"></canvas>
      <p class="notice">扫描二维码，分享此文章</p>
    </div>
    
    <!-- 二维码 END -->
    
    <!-- No Comment -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
  <aside class="catalog-container">
  <div class="toc-main">
    <strong class="toc-title">Catalog</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Centos-安装-nfs"><span class="toc-nav-text">Centos 安装 nfs</span></a></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'https://fengzhaoy.github.io/2019/05/24/Linux/Centos安装nfs/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

    // error image
    $(".markdown-content img").on('error', function () {
      $(this).attr('src', 'http://file.muyutech.com/error-img.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function () {
      var src = $(this).attr('src')
      if (src !== 'http://file.muyutech.com/error-img.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()

        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="' + src +
          '" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function () {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })
  })();
</script>


<script>
  var qr = new QRious({
    element: document.getElementById('share-qrcode'),
    value: document.location.href
  });
</script>





    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2019
  </p>
</footer>

<script>
  function async (u, c) {
    var d = document,
      t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) {
      o.addEventListener('load', function (e) {
        c(null, e);
      }, false);
    }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async ("//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js", function () {
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async ("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js", function () {
    $('figure pre').each(function (i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->

<script src="/js/script.js"></script>
  </body>
</html>